<?php if($this->session->userdata('user_id')==TRUE){?>
    <a href="<?php echo site_url('blog/add_blog') ?>">Ajouter nouveau blog</a>
<?php } ?>
    <div id="wrapper-content" >
  <div class="titre_home" >Liste des blogs</div>
<table width="90%">
    <?php for($i=0;$i<count($blogs);$i++):?>
        <?php $blog = $blogs[$i];?>
        <tr>
            <td style="padding:5px 0px 5px 0px"><a class="titre_blog" href="<?php echo site_url('blog/detail_blog/'.$blog['id']) ?>"><?php echo $blog['name']?></a></td>
        </tr>
        <tr>
            <?php
                $datestring = "%d/%m/%Y"; 
                $time=$blog['blog_date'];
                $mdate = mdate($datestring, $time); 
            ?>
            <td colspan="2"><?php echo $mdate; ?></td>
        </tr>
        <tr>
            <?php
                $image_path = './assets/img_blog/thumbs/' . $blog['image'];
                $image_path_full =  './assets/img_blog/' . $blog['image'];
                if (file_exists($image_path) && $blog['image']!=null && file_exists($image_path_full)) {
                    $image_path = base_url(). 'assets/img_blog/thumbs/' . $blog['image'];
                    $image_path_full=base_url(). 'assets/img_blog/' . $blog['image'];
                } else {
                    $image_path = root_url('seatting-falin') . 'assets/noimage.gif';
                    $image_path_full = root_url('seatting-falin') .'assets/noimage.gif';  
                }
            ?>  
            <td valign="center">
            <a href="<?php echo $image_path_full?>" id="example5" title="">
            <img src="<?php echo $image_path ;?>" height="150px"  alt="">
            </a>
            </td>
            <td style="padding-left: 10px;"><?php echo $blog['description']?></td>
        </tr>
        <tr >
            <td colspan="2">Publié par: <?php echo $blog['display_name']?> |
            <a href="<?php echo site_url('blog/detail_blog/'.$blog['id']);?>">Commentaire (<?php echo count_comment($blog['id']); ?>)</a><?php if($this->session->userdata('user_id')==$blog['user_id']){ ?>
           | <a href="<?php echo site_url('blog/update_blog/'.$blog['id']);?>">Modifier</a>
            <?php }?> </td>
        </tr>
    <?php endfor;?>    
</table>
 <?php echo $pagination; ?>
    </div>

